# clear清除字典对象中所有元素
dct = {'学号': '001', '姓名': 'zhangsan', '年龄': 19}
dct.clear()
print(dct)

# copy复制字典对象dct
dct = {'学号': '001', '姓名': 'zhangsan', '年龄': 19}
d = dct.copy()
print(d)
print(d == dct)

# del删除字典对象中的元素
dct = {'学号': '001', '姓名': 'zhangsan', '年龄': 19}
del dct['年龄']
print(dct)

# get获得字典对象中键对应的值
dct = {'学号': '001', '姓名': 'zhangsan', '年龄': 19}
print(dct.get('年龄'))  # 获取字典中键为“年龄”的值
print(dct['性别'])  # 报错
print(dct.get('性别'))  # 字典中无“性别”键则返回空值None
print(dct.get('性别', '男'))  # 字典中无“性别”键则默认取“男”
